package com.ruoyi.zhoubao.controller;

import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.zhoubao.domain.ReqZbTran25;
import com.ruoyi.zhoubao.service.IReqZbTran25Service;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * zhoubao25Controller
 * 
 * @author ruoyi
 * @date 2025-10-21
 */
@Controller
@RequestMapping("/zhoubao/tran25")
public class ReqZbTran25Controller extends BaseController
{
    private String prefix = "zhoubao/tran25";

    @Autowired
    private IReqZbTran25Service reqZbTran25Service;

    @RequiresPermissions("zhoubao:tran25:view")
    @GetMapping()
    public String tran25()
    {
        return prefix + "/tran25";
    }

    /**
     * 查询zhoubao25列表
     */
    @RequiresPermissions("zhoubao:tran25:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(ReqZbTran25 reqZbTran25)
    {
        startPage();
        List<ReqZbTran25> list = reqZbTran25Service.selectReqZbTran25List(reqZbTran25);
        return getDataTable(list);
    }

    /**
     * 导出zhoubao25列表
     */
    @RequiresPermissions("zhoubao:tran25:export")
    @Log(title = "zhoubao25", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(ReqZbTran25 reqZbTran25)
    {
        List<ReqZbTran25> list = reqZbTran25Service.selectReqZbTran25List(reqZbTran25);
        ExcelUtil<ReqZbTran25> util = new ExcelUtil<ReqZbTran25>(ReqZbTran25.class);
        return util.exportExcel(list, "zhoubao25数据");
    }

    /**
     * 新增zhoubao25
     */
    @RequiresPermissions("zhoubao:tran25:add")
    @GetMapping("/add")
    public String add()
    {
        return prefix + "/add";
    }

    /**
     * 新增保存zhoubao25
     */
    @RequiresPermissions("zhoubao:tran25:add")
    @Log(title = "zhoubao25", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ResponseBody
    public AjaxResult addSave(ReqZbTran25 reqZbTran25)
    {
        return toAjax(reqZbTran25Service.insertReqZbTran25(reqZbTran25));
    }

    /**
     * 修改zhoubao25
     */
    @RequiresPermissions("zhoubao:tran25:edit")
    @GetMapping("/edit/{需求分配}")
    public String edit(@PathVariable("需求分配") Long 需求分配, ModelMap mmap)
    {
        ReqZbTran25 reqZbTran25 = reqZbTran25Service.selectReqZbTran25By需求分配(需求分配);
        mmap.put("reqZbTran25", reqZbTran25);
        return prefix + "/edit";
    }

    /**
     * 修改保存zhoubao25
     */
    @RequiresPermissions("zhoubao:tran25:edit")
    @Log(title = "zhoubao25", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    @ResponseBody
    public AjaxResult editSave(ReqZbTran25 reqZbTran25)
    {
        return toAjax(reqZbTran25Service.updateReqZbTran25(reqZbTran25));
    }

    /**
     * 删除zhoubao25
     */
    @RequiresPermissions("zhoubao:tran25:remove")
    @Log(title = "zhoubao25", businessType = BusinessType.DELETE)
    @PostMapping( "/remove")
    @ResponseBody
    public AjaxResult remove(String ids)
    {
        return toAjax(reqZbTran25Service.deleteReqZbTran25By需求分配s(ids));
    }
}
